import { $Http } from '@/config/service/http';

export enum Api {
  // 公共文件目录
  filePage = '/dmsfile/commonFileDirectory/page', // 分页查询公共文件目录
  fileAdd = '/dmsfile/commonFileDirectory/save', // 添加文件类型-编辑修改文件类型
  fileTree = '/dmsfile/commonFileDirectory/tree', // 查询文件类型树
  fileGet = '/dmsfile/commonFileDirectory/get', // 获取文件类型详情
  fileDelete = '/dmsfile/commonFileDirectory/delete', // 删除文件类型
  fileUpdateStatus = '/dmsfile/commonFileDirectory/updateStatus', // 修改文件类型状态
  findCanUseTree = '/dmsfile/commonFileDirectory/findCanUseTree' // 查询状态能引用的类型树
}

export const fileAdd = (params) => {
  return $Http.api(Api.fileAdd, params, 'post');
};

export const fileTree = (params) => {
  return $Http.api(Api.fileTree, params, 'post');
};

export const fileGet = (id) => {
  return $Http.api(`${Api.fileGet}/${id}`, null, 'get');
};

export const fileDelete = (id) => {
  return $Http.api(`${Api.fileDelete}/${id}`, { id }, 'post', true);
};

export const fileUpdateStatus = (id) => {
  return $Http.api(`${Api.fileUpdateStatus}/${id}`, null, 'get');
};

export const findCanUseTree = (params) => {
  return $Http.api(Api.findCanUseTree, params, 'post');
};
